package com.example.springboot0507.service;

import com.example.springboot0507.exception.ServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author 王博
 * @DateTime 2025-05-09 13:27
 */
@Service
@Slf4j
public class FirstService {

    @Resource
    private JdbcTemplate jdbcTemplate;

    public void sayHello(String name) {
//        if (StringUtils.equals(name,"王博")) {
//            throw new ServiceException("异常了");
//        }
        jdbcTemplate.execute("insert into user(name) values('王博')");
        log.info("Hello {}", name);
    }
}
